import os, os.path
from django.core.management.base import BaseCommand, CommandError
from market.baseCreator import getAssetsStratAndPlayer, constructRoomFromFiles

##################################################################################################
# open the file, check the validity of requiered files and create the base
class Command(BaseCommand):
    help = 'create the player information according to the files in the specified directory'

    ##################################################################################################
    # execute th command
    def handle(self, *args, **options):
        path0 = ''
        if len( args )> 0:
            path0 = args[0]
        #open the file, check the validity of requiered files
        dictionariesForAssetsStrategiesAndPlayers = getAssetsStratAndPlayer(path0)
        #construct the base from the differents objects
        constructRoomFromFiles( dictionariesForAssetsStrategiesAndPlayers[0],dictionariesForAssetsStrategiesAndPlayers[1],dictionariesForAssetsStrategiesAndPlayers[2] )

        return


               
        


